package org.blogwu.learn.designpattern.chapter23.v2;

import java.util.LinkedList;
import java.util.Queue;

public class 服务员 {
    private Queue<命令> orders = new LinkedList<>(); // 巨集佇列命令

    public void addOrder(命令 command) {
        orders.offer(command);
    }

    public void cancelOrder(命令 command) {
        orders.remove(command);
    }

    public void sendOrders() {
        while (!orders.isEmpty()) {
            命令 cmd = orders.poll();
            cmd.execute();
        }
    }
}
